# -*- coding:utf-8 -*-
import pytest

from pages.example import Example
from config.constant import (
    EXAMPLE_A, EXAMPLE_B,
    ADD_RESULT, SUB_RESULT,
    MULTI_RESULT, DIVI_RESULT
)


class TestExample(object):
    """
    测试列子的用例
    """
    # 类里的第一批次执行,所有的用例执行前执行

    def setup_class(self):
        print("setup_class开始")
        self.a = EXAMPLE_A
        self.b = EXAMPLE_B
        self.ex = Example()

    # 类里的第一批次执行,所有的用例执行前执行
    def teardown_class(self):
        print("teardown_class结束")

    @pytest.mark.skip
    @pytest.mark.exampl_add
    def testAdd(self):
        """
        测试加法
        :return:
        """
        result = self.ex.add_num(self.a, self.b)
        assert result == ADD_RESULT

    @pytest.mark.skip
    @pytest.mark.exampl_sub
    def testSub(self):
        """
        测试加法
        :return:
        """
        result = self.ex.sub_num(self.a, EXAMPLE_B)
        assert result == SUB_RESULT

    @pytest.mark.skip
    @pytest.mark.exampl_mul
    def testMul(self):
        """
        测试除法
        :return:
        """
        result = self.ex.multi_num(self.a, self.b)
        assert result == MULTI_RESULT

    @pytest.mark.skip
    @pytest.mark.exampl_divi
    def testDivi(self):
        """
        测试除法
        :return:
        """
        result = self.ex.divi_num(self.a, self.b)
        assert result == DIVI_RESULT


if __name__ == "__main__":
    pass

